package com.small.view;

import java.util.ArrayList;
import java.util.List;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.small.R;

public class User_listAda extends BaseAdapter{

	List<String> list; 
	LayoutInflater li;
	public User_listAda(Context co){
		this.li=LayoutInflater.from(co);
		list = new ArrayList<String>();
		list.add("个人信息");
		list.add("切换帐号");
		list.add("关注的商家");
		list.add("我的收藏");
		list.add("系统消息");
		list.add("系统设置");
		list.add("检测升级");
	}
	
	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return list.size();
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		convertView=null;
		convertView=li.inflate(R.layout.list_txt_item, null);
		ImageView img=(ImageView)convertView.findViewById(R.id.item_img);
		ImageView img01=(ImageView)convertView.findViewById(R.id.itme_txt_01);
		ImageView img02=(ImageView)convertView.findViewById(R.id.itme_txt_03);
		TextView txt_name=(TextView)convertView.findViewById(R.id.itme_txt_02);
		txt_name.setText(list.get(position));
		switch (position) {
		case 0:
			img.setBackgroundResource(R.drawable.list_jiange);
			img01.setBackgroundResource(R.drawable.view_list_txt_top_1_bg);
			img02.setBackgroundResource(R.drawable.view_list_txt_top_3_bg);
			txt_name.setBackgroundResource(R.drawable.view_list_txt_top_2_bg);
			break;
		case 1:
			img01.setBackgroundResource(R.drawable.view_list_txt_bottom_1_bg);
			img02.setBackgroundResource(R.drawable.view_list_txt_bottom_3_bg);
			txt_name.setBackgroundResource(R.drawable.view_list_txt_bottom_2_bg);
			img02.setPadding(0, -1, 0, 0);
			break;
		case 2:
			img.setBackgroundResource(R.drawable.list_jiange);
			img01.setBackgroundResource(R.drawable.view_list_txt_top_1_bg);
			img02.setBackgroundResource(R.drawable.view_list_txt_top_3_bg);
			txt_name.setBackgroundResource(R.drawable.view_list_txt_top_2_bg);
			break;
		case 3:
			img01.setBackgroundResource(R.drawable.view_list_txt_bottom_1_bg);
			img02.setBackgroundResource(R.drawable.view_list_txt_bottom_3_bg);
			txt_name.setBackgroundResource(R.drawable.view_list_txt_bottom_2_bg);
			img02.setPadding(0, -1, 0, 0);
			break;
		case 4:
			img.setBackgroundResource(R.drawable.list_jiange);
			img01.setBackgroundResource(R.drawable.view_list_txt_top_1_bg);
			img02.setBackgroundResource(R.drawable.view_list_txt_top_3_bg);
			txt_name.setBackgroundResource(R.drawable.view_list_txt_top_2_bg);
			break;
		case 5:
			img01.setBackgroundResource(R.drawable.view_list_txt_center_1_bg);
			img02.setBackgroundResource(R.drawable.view_list_txt_center_3_bg);
			txt_name.setBackgroundResource(R.drawable.view_list_txt_center_2_bg);
			img02.setPadding(0, -1, 0, 0);
			break;
		case 6:
			img01.setBackgroundResource(R.drawable.view_list_txt_bottom_1_bg);
			img02.setBackgroundResource(R.drawable.view_list_txt_bottom_3_bg);
			txt_name.setBackgroundResource(R.drawable.view_list_txt_bottom_2_bg);
			img02.setPadding(0, -1, 0, 0);
			break;
		}
		
		
		return convertView;
	}

}
